package project2;

import java.util.Scanner;

public class Main3_17 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		System.out.println("剪刀 (0), 石头(1), 布(2):");
		int numByUser = input.nextInt();
		int numByComputer = (int) (Math.random() * 3);
		// 电脑随机产生0——2
		if (numByUser == numByComputer) {
			// 如果用户输入=电脑随机产生
			switch (numByUser) {
			case 0:
				System.out.println("电脑是剪刀，你也是剪刀.平局.");
				break;
			case 1:
				System.out.println("电脑是石头.你也是石头，平局.");
				break;
			case 2:
				System.out.println("电脑是布.你也是布，平局.");
				break;
			}
		} else if ((numByUser == 0 && numByComputer == 2)// 输入剪刀并且电脑是布

				|| (numByUser == 1 && numByComputer == 0)// 输入石头并且电脑是剪刀

				|| (numByUser == 2 && numByComputer == 1)) {// 输入布并且电脑是石头

			switch (numByUser) {
			case 0:
				System.out.println("电脑是布，你是剪刀.赢.");
				break;
			case 1:
				System.out.println("电脑是剪刀，你是石头.赢.");
				break;
			case 2:
				System.out.println("电脑是石头，你是布.赢.");
				break;
			}
		} else if ((numByUser == 0 && numByComputer == 1)
				|| (numByUser == 1 && numByComputer == 2)
				|| (numByUser == 2 && numByComputer == 0)) {
			switch (numByUser) {
			case 0:
				System.out.println("电脑是石头，你是剪刀.输!");
				break;
			case 1:
				System.out.println("电脑是布，你是石头.输!");
				break;
			case 2:
				System.out.println("电脑是剪刀，你是布.输!");
				break;
			}
		}
	}
}
